package interfaces.clients.storage;

import java.util.List;


/**
 * File repository.
 *
 * @author Chirkov Ivan
 */
public interface Repository {
	/**
	 * Returns the content of the file.
	 *
	 * @param filename path to the file from the root directory of the project.
	 * @param version  version needed.
	 * @return String which is the content of the file.
	 */
	String getFile(String filename, int version) throws StorageFileNotFoundException, StorageIOException;

	/**
	 * Writes the content to the file.
	 *
	 * @param filename path to the file from the root directory of the project.
	 * @param content  file content.
	 */
	void putFile(String filename, String content) throws StorageIOException, StorageFileNotFoundException;

	/**
	 * Returns the last version of the file.
	 *
	 * @param filename path to the file from the root directory of the project.
	 * @return 0 if file doesn't exist, file's last version in the other case.
	 */
	int getLastVersion(String filename);

	/**
	 * Returns files in the project
	 *
	 * @return List of files in the project.
	 */
	List getFiles();
}
